package com.cn.steam.iam.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cn.steam.iam.mapper.iam.IamUserMapper;
import com.cn.steam.iam.model.IamUserDetails;
import com.cn.steam.iam.model.po.IamPermission;
import com.cn.steam.iam.model.po.IamUser;
import com.cn.steam.iam.model.po.IamUserGranter;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author huangzz
 */
@Service
public class IamUserProfileService extends ServiceImpl<IamUserMapper, IamUser> {

	public IamUserDetails selectByLoginName(String loginName) {
		return getBaseMapper().selectByLoginName(loginName);
	}

	public List<IamUserGranter> listUserGranter(String userId){
		return getBaseMapper().listUserGranter(userId);
	}

	public List<IamPermission> listUserPermissions(String userId){
		return getBaseMapper().listUserPermissions(userId);
	}

	public IamUser selectByPartnerIdAndType(String partnerId, String userType){
		return getBaseMapper().selectByPartnerIdAndType(partnerId, userType);
	}

	public IPage<IamUser> testList(){
		Page<IamUser> page = new Page<>(1, 1);
		page.setSearchCount(true);
		page.setOptimizeCountSql(false);
		return baseMapper.testList(page, "ssss");
	}
}
